/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ejb.facade;

import ejb.entity.Compte;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author Trasheur
 */
@Stateless
public class CompteFacade extends AbstractFacade<Compte> implements CompteFacadeLocal, ejb.facade.CompteFacadeRemote {

    @PersistenceContext(unitName = "INF3_BANQUE-ejbPU-COMPTE")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public CompteFacade() {
        super(Compte.class);
    }

    @Override
    public List<Compte> findAll(Integer idClient) {
        Query cq = getEntityManager().createNamedQuery("Compte.findByIdClient");
        cq.setParameter("idClient", idClient);
        return cq.getResultList();
    }
}
